#ifndef _SHD_VERTEX_HLSL_
#define _SHD_VERTEX_HLSL_

#include "./shd_position.hlsl"

//--------------------------------------------------------------------------------------
// Vertex shader section
//--------------------------------------------------------------------------------------
struct VS_CONTROL_POINT_INPUT {
	int vIndex				: INDEX;
//	float3 vPosition		: POSITION;
};

struct VS_CONTROL_POINT_OUTPUT {
	int vIndex				: INDEX;
	float3 vPosition		: POSITION;
	float3 vTangent			: TANGENT;
};

// This simple vertex shader passes the control points straight through to the
// hull shader.  In a more complex scene, you might transform the control points
// or perform skinning at this step.

// The input to the vertex shader comes from the vertex buffer.

// The output from the vertex shader will go into the hull shader.

VS_CONTROL_POINT_OUTPUT VS( VS_CONTROL_POINT_INPUT Input ) {
	VS_CONTROL_POINT_OUTPUT Output;

	Output.vIndex = Input.vIndex;

	Output.vPosition = Position_Interpol( Input.vIndex, g_iQttControlPoints, g_iTimer, g_iLimitTime, g_fInterpolationTimer );

	Output.vTangent = float3( 0.0, 0.0, 0.0 );
	if( Output.vIndex < g_iQttControlPoints - 1 ) { // if it's not the last control point
		float3 position1 = Output.vPosition;
		float3 position2 = Position_Interpol( Input.vIndex + 1, g_iQttControlPoints, g_iTimer, g_iLimitTime, g_fInterpolationTimer );

		Output.vTangent = position2 - position1;
	}

	return Output;
};


#endif // _SHD_VERTEX_HLSL_
